package com.qj.daibei.controller;

import com.qj.daibei.pojo.Province;
import com.qj.daibei.service.ProvinceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * author wml
 * Created on 2021/9/24 15:03
 */
@Controller
public class ProvinceController {

    @Autowired
    private ProvinceService provinceService;

    /**
     * 查询所有的省份
     * @Author wml
     * @return 返回一个 JSON 格式的省份集合
     */
    @GetMapping("/ajaxGetProvince")
    public ResponseEntity<List<Province>> ajaxGetProvince() {
        List<Province> provinceList = this.provinceService.queryAllProvince();
        return new ResponseEntity<List<Province>>(provinceList, HttpStatus.OK);
    }
}
